package dao;

import bean.User;
import org.junit.Test;

import java.util.List;

/**
 * Date:2022/2/28
 * Author:ybc
 * Description:
 */
public class UserDao extends BaseDao<User> {

    @Test
    public void testInsert(){
        int result = update("insert into t_user(username,password) values(?,?)", "admin", "123456");
        System.out.println("结果："+result);
    }

    @Test
    public void testGetBean(){
        User user = getBean(User.class, "select * from t_user where id = ?", 1);
        System.out.println(user);
    }

    @Test
    public void testGetBeanList(){
        List<User> list = getBeanList(User.class, "select * from t_user");
        list.forEach(System.out::println);
    }

    @Test
    public void getGetSingleData(){
        Long count = (Long) getSingleData("select count(*) from t_user");
        System.out.println(count.intValue());
    }

}
